package com.party.core.model.mall;

import com.google.common.collect.Maps;

import java.util.Map;

/**
 * 资源类型枚举
 * Created by yifeng
 *
 * @date 2018/4/9 0009
 * @time 下午 16:33
 */
public enum MallStoreResourcesType {
    SUBJECT(1, "专题"),

    GOODS(2, "商品"),

    CATEGORY(3, "分类"),

    LINK(4, "链接"),

    BRAND(5, "品牌");

    private Integer code;

    private String value;

    MallStoreResourcesType(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public static String getValue(Integer code) {
        for (MallStoreResourcesType memberType : MallStoreResourcesType.values()) {
            if (memberType.getCode().equals(code)) {
                return memberType.getValue();
            }
        }
        return null;
    }

    public static Map<Integer, String> convertMap() {
        Map<Integer, String> map = Maps.newHashMap();
        for (MallStoreResourcesType memberType : MallStoreResourcesType.values()) {
            map.put(memberType.getCode(), memberType.getValue());
        }
        return map;
    }
}
